/* rcctwbu2.p - Container Workbench - Delete all records in a chain           */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.4.3.3 $                                                         */
/*V8:ConvertMode=NoConvert                                                    */
/* REVISION: 7.5    LAST MODIFIED: 03/21/95           BY: GWM *J049*          */
/* REVISION: 8.6    LAST MODIFIED: 09/20/96           BY: TSI *K005*          */
/* REVISION: 8.6    LAST MODIFIED: 12/17/96   BY: *K03K* Vinay Nayak-Sujir    */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan           */
/* REVISION: 9.1    LAST MODIFIED: 06/01/99   BY: *N004* Patrick Rowan        */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown           */
/* $Revision: 1.4.3.3 $    BY: Jean Miller    DATE: 03/22/01 ECO: *P008*        */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

{mfdeclre.i}

/* INPUT PARAMETERS */
define input parameter abs_recid as recid.

/* LOCAL VARIABLES */
define variable par_id    like abs_par_id no-undo.
define variable ship_from like abs_shipfrom no-undo.

/* VARIABLE DEFINITIONS FOR gpfile.i */
{gpfilev.i}
{gpfile.i &file_name = """"rcf_ctrl""""}

find abs_mstr where recid(abs_mstr) = abs_recid no-lock.

assign
   par_id = abs_mstr.abs_id
   ship_from = abs_shipfrom.

/* SET SHIPTO FOR ALL CHILD CONTAINERS */
for each abs_mstr where
         abs_mstr.abs_shipfrom = ship_from
     and abs_mstr.abs_par_id = par_id
exclusive-lock:

   if abs_id begins "I"
   then do:

      {gprun.i ""rcdlabsr.p"" "(input recid(abs_mstr))"}

      /* IS CUST. SEQ. SCHEDULES INSTALLED ? */
      if can-find (mfc_ctrl where
                   mfc_field = "enable_sequence_schedules" and
                   mfc_logical)
         and file_found
      then do:

         /* DELETE SEQUENCES */
         {gprunmo.i
            &program = ""rcabssdl.p""
            &module = "ASQ"
            &param = """(input recid(abs_mstr), input '' )"""}

      end. /* if can-find */

   end.

   /* Delete custom shipper document information associated
    * with the record */
   {gprun.i ""sofsde.p"" "(input recid(abs_mstr))"}

   {gprun.i ""rcctwbu2.p"" "(input recid(abs_mstr))"}.

   assign
      abs_mstr.abs_shipto = "".

end.
